<?php
/*
 * function that generate the action buttons edit, delete
 * This is just showing the idea you can use it in different view or whatever fits your needs
 */
function get_buttons($id,$module,$mode='complete',$export=false)
{
	$ci = & get_instance();
	$html = '<div class="text-center">';

	if ($mode=='destroy_only') {
		$html .= '<a href="' . base_url() . $module . '/destroy/' . $id . '" class="btn btn-danger btn-sm" onClick="return confirm(\'Anda yakin ingin menghapus data ini?\')"><i class="ion-ios7-trash"></i> Hapus</a>';
	}else if($mode=='edit_only'){
		$html .= '<a href="' . base_url() . $module . '/edit/' . $id . '" class="btn btn-primary btn-sm"><i class="ion-edit"></i> Ubah</a>&nbsp;';
	}else if($mode=='display_only'){
		$html .= '<a href="' . base_url() . $module . '/display/' . $id . '" class="btn btn-info btn-sm"><i class="ion-ios7-eye"></i> Lihat</a>&nbsp;';
	}else if($mode=='default'){
		$html .= '<a href="' . base_url() . $module . '/edit/' . $id . '" class="btn btn-primary btn-sm"><i class="ion-edit"></i> Ubah</a>&nbsp;';
		$html .= '<a href="' . base_url() . $module . '/destroy/' . $id . '" class="btn btn-danger btn-sm" onClick="return confirm(\'Anda yakin ingin menghapus data ini?\')"><i class="ion-ios7-trash"></i> Hapus</a>';
	}else{
		$html .= '<a href="' . base_url() . $module . '/display/' . $id . '" class="btn btn-info btn-sm"><i class="ion-ios7-eye"></i> Lihat</a>&nbsp;';
		$html .= '<a href="' . base_url() . $module . '/edit/' . $id . '" class="btn btn-primary btn-sm"><i class="ion-edit"></i> Ubah</a>&nbsp;';
		$html .= '<a href="' . base_url() . $module . '/destroy/' . $id . '" class="btn btn-danger btn-sm" onClick="return confirm(\'Anda yakin ingin menghapus data ini?\')"><i class="ion-ios7-trash"></i> Hapus</a>';
	}

	if($export)
		$html .= '<a href="' . base_url() . $module . '/export/' . $id . '" class="btn btn-info btn-sm"><i class="ion-card"></i> PDF</a>&nbsp;';
	
	$html .= '</div>';
	return $html;
}